﻿using System;
using System.Collections.Generic;
using System.Text;

using RaisingStudio.Data;
using RaisingStudio.Data.Common;
using RaisingStudio.Data.Expressions;

namespace RaisingStudio.Data.Common
{
    public interface IDataTableAdapter : ITransactionManager
    {
        int Delete(string transactionID);
        int Delete();
        int Delete(string[] columnNames, object[] originalValues);
        int Delete(object[] primaryKeys);
        int Delete(CommonCommand conditionCommand);
        int Delete(System.Collections.Generic.Dictionary<string, object> originalValues);
        int Delete(string[] columnNames, object[] originalValues, string transactionID);
        int Delete(object[] primaryKeys, string transactionID);
        int Delete(CommonCommand conditionCommand, string transactionID);
        int Delete(System.Collections.Generic.Dictionary<string, object> originalValues, string transactionID);
  
        System.Data.DataTable ExecuteDataTable(CommonCommand selectCommand);
        System.Data.DataTable ExecuteDataTable(CommonCommand selectCommand, string transactionID);
        int ExecuteNonQueryCommand(CommonCommand commonCommand, string transactionID);
        int ExecuteNonQueryCommand(CommonCommand commonCommand);
        System.Data.IDataReader ExecuteReaderCommand(CommonCommand commonCommand, string transactionID);
        System.Data.IDataReader ExecuteReaderCommand(CommonCommand commonCommand);
        object ExecuteScalarCommand(CommonCommand commonCommand);
        object ExecuteScalarCommand(CommonCommand commonCommand, string transactionID);
   
        bool Exists(object[] primaryKeys, string transactionID);
        bool Exists(object[] primaryKeys);
    
        int Fill(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords);
        int Fill(System.Data.DataTable dataTable, int startRecord, int maxRecords, string transactionID);
        int Fill(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        int Fill(System.Data.DataTable dataTable, CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        int Fill(System.Data.DataTable dataTable, string[] columnNames, int startRecord, int maxRecords, string transactionID);
        int Fill(System.Data.DataTable dataTable, string[] columnNames, int startRecord, int maxRecords);
        int Fill(System.Data.DataTable dataTable, int startRecord, int maxRecords);
        int Fill(System.Data.DataTable dataTable, CommonCommand conditionCommand, int startRecord, int maxRecords);
        int Fill(System.Data.DataTable dataTable, object[] primaryKeys, string[] columnNames);
        int Fill(System.Data.DataTable dataTable, object[] primaryKeys);
        int Fill(System.Data.DataTable dataTable, string transactionID);
        int Fill(System.Data.DataTable dataTable, string[] columnNames, string transactionID);
        int Fill(System.Data.DataTable dataTable, CommonCommand conditionCommand, string transactionID);
        int Fill(System.Data.DataTable dataTable, string[] columnNames);
        int Fill(System.Data.DataTable dataTable);
        int Fill(System.Data.DataTable dataTable, CommonCommand conditionCommand);
        int Fill(System.Data.DataTable dataTable, object[] primaryKeys, string[] columnNames, string transactionID);
        int Fill(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand);
        int Fill(System.Data.DataTable dataTable, object[] primaryKeys, string transactionID);
        int Fill(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand, string transactionID);
   
        int FillDataTable(System.Data.DataTable dataTable, CommonCommand selectCommand);
        int FillDataTable(System.Data.DataTable dataTable, CommonCommand selectCommand, string transactionID);
  
        int FillView(System.Data.DataTable dataTable, CommonCommand conditionCommand, string transactionID);
        int FillView(System.Data.DataTable dataTable, CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        int FillView(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        int FillView(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand, string transactionID);
        int FillView(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand);
        int FillView(System.Data.DataTable dataTable, CommonCommand conditionCommand);
        int FillView(System.Data.DataTable dataTable, string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords);
        int FillView(System.Data.DataTable dataTable, CommonCommand conditionCommand, int startRecord, int maxRecords);
     
        object GetAvgData(string columnName, CommonCommand conditionCommand, string transactionID);
        object GetAvgData(string columnName, string transactionID);
        object GetAvgData(string columnName, CommonCommand conditionCommand);
        object GetAvgData(string columnName);
        object GetMaxData(string columnName, CommonCommand conditionCommand);
        object GetMaxData(string columnName);
        object GetMaxData(string columnName, string transactionID);
        object GetMaxData(string columnName, CommonCommand conditionCommand, string transactionID);
        object GetMinData(string columnName, CommonCommand conditionCommand);
        object GetMinData(string columnName, string transactionID);
        object GetMinData(string columnName, CommonCommand conditionCommand, string transactionID);
        object GetMinData(string columnName);
        object GetSumData(string columnName, CommonCommand conditionCommand);
        object GetSumData(string columnName);
        object GetSumData(string columnName, string transactionID);
        object GetSumData(string columnName, CommonCommand conditionCommand, string transactionID);
        int GetDataCount(CommonCommand conditionCommand);
        int GetDataCount(CommonCommand conditionCommand, string transactionID);
        int GetDataCount(string transactionID);
        int GetDataCount();
    
        System.Data.DataTable GetData(string transactionID);
        System.Data.DataTable GetData(object[] primaryKeys, string transactionID);
        System.Data.DataTable GetData(object[] primaryKeys, string[] columnNames, string transactionID);
        System.Data.DataTable GetData(string[] columnNames, int startRecord, int maxRecords);
        System.Data.DataTable GetData(int startRecord, int maxRecords);
        System.Data.DataTable GetData(string[] columnNames, string transactionID);
        System.Data.DataTable GetData(CommonCommand conditionCommand, int startRecord, int maxRecords);
        System.Data.DataTable GetData();
        System.Data.DataTable GetData(CommonCommand conditionCommand, string transactionID);
        System.Data.DataTable GetData(string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords);
        System.Data.DataTable GetData(string[] columnNames, CommonCommand conditionCommand, string transactionID);
        System.Data.DataTable GetData(CommonCommand conditionCommand);
        System.Data.DataTable GetData(string[] columnNames);
        System.Data.DataTable GetData(string[] columnNames, CommonCommand conditionCommand);
        System.Data.DataTable GetData(object[] primaryKeys, string[] columnNames);
        System.Data.DataTable GetData(object[] primaryKeys);
        System.Data.DataTable GetData(string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        System.Data.DataTable GetData(CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        System.Data.DataTable GetData(string[] columnNames, int startRecord, int maxRecords, string transactionID);
        System.Data.DataTable GetData(int startRecord, int maxRecords, string transactionID);
  
        object GetViewAvgData(string columnName, CommonCommand conditionCommand, string transactionID);
        object GetViewAvgData(string columnName, CommonCommand conditionCommand);
        object GetViewMaxData(string columnName, CommonCommand conditionCommand, string transactionID);
        object GetViewMaxData(string columnName, CommonCommand conditionCommand);
        object GetViewMinData(string columnName, CommonCommand conditionCommand, string transactionID);
        object GetViewMinData(string columnName, CommonCommand conditionCommand);
        object GetViewSumData(string columnName, CommonCommand conditionCommand, string transactionID);
        object GetViewSumData(string columnName, CommonCommand conditionCommand);
        int GetViewDataCount(CommonCommand conditionCommand, string transactionID);
        int GetViewDataCount(CommonCommand conditionCommand);
     
        System.Data.DataTable GetViewData(string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        System.Data.DataTable GetViewData(CommonCommand conditionCommand, int startRecord, int maxRecords, string transactionID);
        System.Data.DataTable GetViewData(CommonCommand conditionCommand, string transactionID);
        System.Data.DataTable GetViewData(string[] columnNames, CommonCommand conditionCommand, string transactionID);
        System.Data.DataTable GetViewData(string[] columnNames, CommonCommand conditionCommand);
        System.Data.DataTable GetViewData(CommonCommand conditionCommand);
        System.Data.DataTable GetViewData(CommonCommand conditionCommand, int startRecord, int maxRecords);
        System.Data.DataTable GetViewData(string[] columnNames, CommonCommand conditionCommand, int startRecord, int maxRecords);
     
        int Insert(object[] values);
        int Insert(string[] columnNames, object[] values, string transactionID);
        int Insert(System.Collections.Generic.Dictionary<string, object> values, string transactionID);
        int Insert(object[] values, string transactionID);
        int Insert(string[] columnNames, object[] values);
        int Insert(System.Collections.Generic.Dictionary<string, object> values);
  
        int Save(object[] values);
        int Save(object[] values, string transactionID);
  
        int Update(System.Data.DataRow[] dataRows, string[] columnNames, UpdateBehavior updateBehavior, string transactionID);
        int Update(System.Data.DataTable dataTable, bool checkConcurrency, UpdateBehavior updateBehavior, string transactionID);
        int Update(System.Data.DataRow[] dataRows, string[] columnNames, bool checkConcurrency, UpdateBehavior updateBehavior, string transactionID);
        int Update(CommonCommand conditionCommand, object[] values);
        int Update(System.Data.DataTable dataTable, string[] columnNames, bool checkConcurrency, UpdateBehavior updateBehavior, string transactionID);
        int Update(System.Data.DataRow[] dataRows, bool checkConcurrency, UpdateBehavior updateBehavior, string transactionID);
        int Update(System.Data.DataRow[] dataRows, UpdateBehavior updateBehavior, string transactionID);
        int Update(System.Data.DataRow dataRow, bool checkConcurrency, string transactionID);
        int Update(System.Data.DataRow[] dataRows, string[] columnNames, bool checkConcurrency, string transactionID);
        int Update(System.Data.DataRow[] dataRows, bool checkConcurrency, string transactionID);
        int Update(System.Data.DataTable dataTable, string[] columnNames, UpdateBehavior updateBehavior, string transactionID);
        int Update(System.Data.DataTable dataTable, UpdateBehavior updateBehavior, string transactionID);
        int Update(System.Data.DataRow dataRow, string[] columnNames, bool checkConcurrency, string transactionID);
        int Update(System.Data.DataTable dataTable, string[] columnNames);
        int Update(System.Data.DataTable dataTable);
        int Update(System.Data.DataRow dataRow, string[] columnNames);
        int Update(System.Data.DataRow[] dataRows);
        int Update(System.Data.DataRow[] dataRows, string[] columnNames);
        int Update(System.Data.DataRow dataRow);
        int Update(object[] values);
        int Update(object[] primaryKeys, System.Collections.Generic.Dictionary<string, object> values);
        int Update(string[] columnNames, object[] originalValues, object[] values);
        int Update(System.Collections.Generic.Dictionary<string, object> originalValues, System.Collections.Generic.Dictionary<string, object> values);
        int Update(object[] primaryKeys, string[] columnNames, object[] values);
        int Update(string[] columnNames, object[] values);
        int Update(System.Collections.Generic.Dictionary<string, object> values);
        int Update(object[] primaryKeys, object[] values);
        int Update(System.Data.DataRow[] dataRows, UpdateBehavior updateBehavior);
        int Update(object[] values, string transactionID);
        int Update(System.Data.DataTable dataTable, bool checkConcurrency, UpdateBehavior updateBehavior);
        int Update(System.Data.DataRow[] dataRows, string[] columnNames, UpdateBehavior updateBehavior);
        int Update(string[] columnNames, object[] values, string transactionID);
        int Update(object[] primaryKeys, string[] columnNames, object[] values, string transactionID);
        int Update(object[] primaryKeys, System.Collections.Generic.Dictionary<string, object> values, string transactionID);
        int Update(System.Collections.Generic.Dictionary<string, object> values, string transactionID);
        int Update(object[] primaryKeys, object[] values, string transactionID);
        int Update(System.Data.DataTable dataTable, string[] columnNames, string transactionID);
        int Update(System.Data.DataRow[] dataRows, string transactionID);
        int Update(System.Data.DataRow[] dataRows, string[] columnNames, bool checkConcurrency, UpdateBehavior updateBehavior);
        int Update(System.Data.DataTable dataTable, string transactionID);
        int Update(System.Data.DataRow[] dataRows, string[] columnNames, string transactionID);
        int Update(System.Data.DataRow[] dataRows, bool checkConcurrency, UpdateBehavior updateBehavior);
        int Update(System.Data.DataTable dataTable, string[] columnNames, bool checkConcurrency, UpdateBehavior updateBehavior);
        int Update(System.Data.DataRow dataRow, string transactionID);
        int Update(System.Data.DataRow dataRow, string[] columnNames, string transactionID);
        int Update(string[] columnNames, object[] originalValues, object[] values, string transactionID);
        int Update(System.Data.DataRow[] dataRows, bool checkConcurrency);
        int Update(System.Data.DataTable dataTable, string[] columnNames, bool checkConcurrency);
        int Update(System.Data.DataRow dataRow, bool checkConcurrency);
        int Update(System.Data.DataRow[] dataRows, string[] columnNames, bool checkConcurrency);
        int Update(System.Data.DataTable dataTable, bool checkConcurrency);
        int Update(System.Data.DataTable dataTable, bool checkConcurrency, string transactionID);
        int Update(System.Data.DataTable dataTable, string[] columnNames, bool checkConcurrency, string transactionID);
        int Update(CommonCommand conditionCommand, System.Collections.Generic.Dictionary<string, object> values);
        int Update(CommonCommand conditionCommand, string[] columnNames, object[] values);
        int Update(CommonCommand conditionCommand, string[] columnNames, object[] values, string transactionID);
        int Update(CommonCommand conditionCommand, object[] values, string transactionID);
        int Update(System.Collections.Generic.Dictionary<string, object> originalValues, System.Collections.Generic.Dictionary<string, object> values, string transactionID);
        int Update(CommonCommand conditionCommand, System.Collections.Generic.Dictionary<string, object> values, string transactionID);
        int Update(System.Data.DataRow dataRow, string[] columnNames, bool checkConcurrency);
        int Update(System.Data.DataTable dataTable, UpdateBehavior updateBehavior);
        int Update(System.Data.DataTable dataTable, string[] columnNames, UpdateBehavior updateBehavior);
    
        int UpdateDataTable(System.Data.DataTable dataTable, CommonCommand insertCommand, CommonCommand updateCommand, CommonCommand deleteCommand, UpdateBehavior updateBehavior);
        int UpdateDataTable(System.Data.DataTable dataTable, CommonCommand insertCommand, CommonCommand updateCommand, CommonCommand deleteCommand);
        int UpdateDataTable(System.Data.DataTable dataTable, CommonCommand insertCommand, CommonCommand updateCommand, CommonCommand deleteCommand, UpdateBehavior updateBehavior, string transactionID);
        int UpdateDataTable(System.Data.DataTable dataTable, CommonCommand insertCommand, CommonCommand updateCommand, CommonCommand deleteCommand, string transactionID);
        
        #region Extension Functions
        #region Common Methods
        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, RaisingStudio.Data.Expressions.ConditionExpression conditionExpression);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, RaisingStudio.Data.Expressions.ConditionExpression conditionExpression);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillByPrimaryKey(System.Data.DataTable dataTable, object primaryKey);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillByPrimaryKey(System.Data.DataTable dataTable, object primaryKey, ColumnExpression[] columnExpressions);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions, RaisingStudio.Data.Expressions.ConditionExpression conditionExpression);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetDataByPrimaryKey(object primaryKey);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetDataByPrimaryKey(object primaryKey, ColumnExpression[] columnExpressions);

        /// <summary>
        /// Delete data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <returns>The count of rows that updated.</returns>
        int DeleteByPrimaryKey(object primaryKey);

        /// <summary>
        /// Delete the data according the condition.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>The count of rows that updated.</returns>
        int Delete(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int UpdateByPrimaryKey(object primaryKey, object[] values);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int UpdateByPrimaryKey(object primaryKey, ColumnExpression[] columnExpressions, object[] values);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int UpdateByPrimaryKey(object primaryKey, Dictionary<string, object> values);

        /// <summary>
        /// Update the data according the condition.
        /// </summary>
        /// <remarks>
        /// Pay attention to the parameter name in the addtion condtion.
        /// </remarks>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, object[] values);

        /// <summary>
        /// Update the data according the condition.
        /// </summary>
        /// <remarks>
        /// Pay attention to the parameter name in the addtion condtion.
        /// </remarks>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, ColumnExpression[] columnExpressions, object[] values);

        /// <summary>
        /// Update the data according the condition.
        /// </summary>
        /// <remarks>
        /// Pay attention to the parameter name in the addtion condtion.
        /// </remarks>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, Dictionary<string, object> values);

        /// <summary>
        /// Check the data by primary key.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <returns>If exists then return true, otherwise return false.</returns>
        bool ExistsByPrimaryKey(object primaryKey);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, RaisingStudio.Data.Expressions.ColumnExpression[] columnExpressions);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="primaryKeys">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, object[] primaryKeys, ColumnExpression[] columnExpressions);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="primaryKeys">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(object[] primaryKeys, ColumnExpression[] columnExpressions);

        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRow">Datarow.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow dataRow, ColumnExpression[] columnExpressions);

        /// <summary>
        /// Delete data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="originalValues">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Delete(ColumnExpression[] columnExpressions, object[] originalValues);

        /// <summary>
        /// Insert data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Insert(ColumnExpression[] columnExpressions, object[] values);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(ColumnExpression[] columnExpressions, object[] values);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKeys">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(object[] primaryKeys, ColumnExpression[] columnExpressions, object[] values);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="originalValues">The original values.</param>
        /// <param name="values">values.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(ColumnExpression[] columnExpressions, object[] originalValues, object[] values);

        #region Normal Functions
        /// <summary>
        /// Gets the data row count according the condition.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>The count of data rows.</returns>
        int GetDataCount(ConditionExpression conditionExpression);

        /// <summary>
        /// Gets the sum of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <returns>the sum of data.</returns>
        object GetSumData(ColumnExpression columnExpression);

        /// <summary>
        /// Gets the sum of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the sum of data.</returns>
        object GetSumData(ColumnExpression columnExpression, ConditionExpression conditionExpression);

        /// <summary>
        /// Gets the avg of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <returns>the avg of data.</returns>
        object GetAvgData(ColumnExpression columnExpression);

        /// <summary>
        /// Gets the avg of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the avg of data.</returns>
        object GetAvgData(ColumnExpression columnExpression, ConditionExpression conditionExpression);

        /// <summary>
        /// Gets the max of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <returns>the max of data.</returns>
        object GetMaxData(ColumnExpression columnExpression);

        /// <summary>
        /// Get the max of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the max of data.</returns>
        object GetMaxData(ColumnExpression columnExpression, ConditionExpression conditionExpression);

        /// <summary>
        /// Gets the min of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <returns>the min of data.</returns>
        object GetMinData(ColumnExpression columnExpression);

        /// <summary>
        /// Get the min of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the min of data.</returns>
        object GetMinData(ColumnExpression columnExpression, ConditionExpression conditionExpression);
        #endregion

        #region 并发冲突及Update 行为
        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, bool checkConcurrency);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions, bool checkConcurrency);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRow">Datarow.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow dataRow, ColumnExpression[] columnExpressions, bool checkConcurrency);

        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, UpdateBehavior updateBehavior);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions, UpdateBehavior updateBehavior);

        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, bool checkConcurrency, UpdateBehavior updateBehavior);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions, bool checkConcurrency, UpdateBehavior updateBehavior);
        #endregion

        #region Paging Operation 
        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, int startRecord, int maxRecords);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ConditionExpression conditionExpression, int startRecord, int maxRecords);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions, int startRecord, int maxRecords);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ConditionExpression conditionExpression, int startRecord, int maxRecords);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords);
        #endregion

        #region View Mode
        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ConditionExpression conditionExpression);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ColumnExpression[] columnExpressions, ConditionExpression conditionExpression);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ConditionExpression conditionExpression);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, ConditionExpression conditionExpression);

        #region Normal Functions
        /// <summary>
        /// Gets the data row count according the condition.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>The count of data rows.</returns>
        int GetViewDataCount(ConditionExpression conditionExpression);

        /// <summary>
        /// Gets the sum of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the sum of data.</returns>
        object GetViewSumData(ColumnExpression columnExpression, ConditionExpression conditionExpression);

        /// <summary>
        /// Gets the avg of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the avg of data.</returns>
        object GetViewAvgData(ColumnExpression columnExpression, ConditionExpression conditionExpression);

        /// <summary>
        /// Get the max of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the max of data.</returns>
        object GetViewMaxData(ColumnExpression columnExpression, ConditionExpression conditionExpression);

        /// <summary>
        /// Get the min of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <returns>the min of data.</returns>
        object GetViewMinData(ColumnExpression columnExpression, ConditionExpression conditionExpression);
        #endregion

        #region Paging Operation 
        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ConditionExpression conditionExpression, int startRecord, int maxRecords);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ConditionExpression conditionExpression, int startRecord, int maxRecords);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords);
        #endregion
        #endregion
        #endregion
        #region Transaction
        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnNames">An array of Columns.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillByPrimaryKey(System.Data.DataTable dataTable, object primaryKey, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="columnNames">An array of Columns.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillByPrimaryKey(System.Data.DataTable dataTable, object primaryKey, ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnNames">An array of Columns.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions, RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetDataByPrimaryKey(object primaryKey, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="columnNames">An array of Columns.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetDataByPrimaryKey(object primaryKey, ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Delete data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int DeleteByPrimaryKey(object primaryKey, string transactionID);

        /// <summary>
        /// Delete the data according the condition.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Delete(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int UpdateByPrimaryKey(object primaryKey, object[] values, string transactionID);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="columnNames">An array of Columns.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int UpdateByPrimaryKey(object primaryKey, ColumnExpression[] columnExpressions, object[] values, string transactionID);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int UpdateByPrimaryKey(object primaryKey, Dictionary<string, object> values, string transactionID);

        /// <summary>
        /// Update the data according the condition.
        /// </summary>
        /// <remarks>
        /// Pay attention to the parameter name in the addtion condtion.
        /// </remarks>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, object[] values, string transactionID);

        /// <summary>
        /// Update the data according the condition.
        /// </summary>
        /// <remarks>
        /// Pay attention to the parameter name in the addtion condtion.
        /// </remarks>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="columnNames">An array of Columns.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, ColumnExpression[] columnExpressions, object[] values, string transactionID);

        /// <summary>
        /// Update the data according the condition.
        /// </summary>
        /// <remarks>
        /// Pay attention to the parameter name in the addtion condtion.
        /// </remarks>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(RaisingStudio.Data.Expressions.ConditionExpression conditionExpression, Dictionary<string, object> values, string transactionID);

        /// <summary>
        /// Check the data by primary key.
        /// </summary>
        /// <param name="primaryKey">The value of primary key.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>If exists then return true, otherwise return false.</returns>
        bool ExistsByPrimaryKey(object primaryKey, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, RaisingStudio.Data.Expressions.ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="primaryKeys">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, object[] primaryKeys, ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="primaryKeys">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(object[] primaryKeys, ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRow">Datarow.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow dataRow, ColumnExpression[] columnExpressions, string transactionID);

        /// <summary>
        /// Delete data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="originalValues">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Delete(ColumnExpression[] columnExpressions, object[] originalValues, string transactionID);

        /// <summary>
        /// Insert data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Insert(ColumnExpression[] columnExpressions, object[] values, string transactionID);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(ColumnExpression[] columnExpressions, object[] values, string transactionID);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="primaryKeys">The value of primary key.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(object[] primaryKeys, ColumnExpression[] columnExpressions, object[] values, string transactionID);

        /// <summary>
        /// Update data.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="originalValues">The original values.</param>
        /// <param name="values">values.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(ColumnExpression[] columnExpressions, object[] originalValues, object[] values, string transactionID);

        #region Normal Functions
        /// <summary>
        /// Gets the data row count according the condition.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of data rows.</returns>
        int GetDataCount(ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets the sum of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the sum of data.</returns>
        object GetSumData(ColumnExpression columnExpression, string transactionID);

        /// <summary>
        /// Gets the sum of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the sum of data.</returns>
        object GetSumData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets the avg of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the avg of data.</returns>
        object GetAvgData(ColumnExpression columnExpression, string transactionID);

        /// <summary>
        /// Gets the avg of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the avg of data.</returns>
        object GetAvgData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets the max of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the max of data.</returns>
        object GetMaxData(ColumnExpression columnExpression, string transactionID);

        /// <summary>
        /// Get the max of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the max of data.</returns>
        object GetMaxData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets the min of data.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the min of data.</returns>
        object GetMinData(ColumnExpression columnExpression, string transactionID);

        /// <summary>
        /// Get the min of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the min of data.</returns>
        object GetMinData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);
        #endregion

        #region 并发冲突及Update 行为
        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, bool checkConcurrency, string transactionID);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions, bool checkConcurrency, string transactionID);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRow">Datarow.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow dataRow, ColumnExpression[] columnExpressions, bool checkConcurrency, string transactionID);

        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, UpdateBehavior updateBehavior, string transactionID);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions, UpdateBehavior updateBehavior, string transactionID);

        /// <summary>
        /// Update Datatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, bool checkConcurrency, UpdateBehavior updateBehavior, string transactionID);

        /// <summary>
        /// Update Datarow.
        /// </summary>
        /// <param name="dataRows">Array of DataRows.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="checkConcurrency">Check concurrency.</param>
        /// <param name="updateBehavior">Update behavior</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of rows that updated.</returns>
        int Update(System.Data.DataRow[] dataRows, ColumnExpression[] columnExpressions, bool checkConcurrency, UpdateBehavior updateBehavior, string transactionID);
        #endregion

        #region Paging Operation 
        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int Fill(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetData(ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);
        #endregion

        #region View Mode
        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, string transactionID);

        #region Normal Functions
        /// <summary>
        /// Gets the data row count according the condition.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The count of data rows.</returns>
        int GetViewDataCount(ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets the sum of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the sum of data.</returns>
        object GetViewSumData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Gets the avg of data according the condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the avg of data.</returns>
        object GetViewAvgData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Get the max of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the max of data.</returns>
        object GetViewMaxData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);

        /// <summary>
        /// Get the min of data according condition.
        /// </summary>
        /// <param name="columnExpression">Column expression.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>the min of data.</returns>
        object GetViewMinData(ColumnExpression columnExpression, ConditionExpression conditionExpression, string transactionID);
        #endregion

        #region Paging Operation 
        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// Gets Datatable.
        /// </summary>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>Datatable.</returns>
        System.Data.DataTable GetViewData(ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);

        /// <summary>
        /// FillDatatable.
        /// </summary>
        /// <param name="dataTable">Datatable.</param>
        /// <param name="columnExpressions">An array of column expressions.</param>
        /// <param name="conditionExpression">Condition expression</param>
        /// <param name="startRecord">The zero-based record number to start with. </param>
        /// <param name="maxRecords">The maximum number of records to retrieve. </param>
        /// <param name="transactionID">The ID of transaction.</param>
        /// <returns>The number of rows successfully added to or refreshed. This does not include rows affected by statements that do not return rows.</returns>
        int FillView(System.Data.DataTable dataTable, ColumnExpression[] columnExpressions, ConditionExpression conditionExpression, int startRecord, int maxRecords, string transactionID);
        #endregion
        #endregion
        #endregion
        #endregion
    }
}
